<template>
  <div class="tab-cotrol">
    <div class="tab-items" v-for="(items, index) in titles" :key="index" @click="checkedclick(index)">
      <span :class="{actived:currentIndex == index}">{{ items }}</span>
    </div>
  </div>
</template>

<script>
export default {
  name: "",
  data() {
    return {
      currentIndex: 0,
    };
  },
  props: {
    titles: {
      type: Array,
      default() {
        return [];
      },
    },
  },
  computed: {
    ischecked() {

    }
  },
  methods: {
    checkedclick(index) {
      this.currentIndex = index
      this.$emit('tabClick',index)
    }
  },
};
</script>

<style scoped>
.tab-cotrol {
  display: flex;
  position: sticky;
  top: 44px;
  z-index: 99;
  background-color: #fff;
  border-top: 2px solid #f3f3f3;
}

.tab-cotrol .tab-items {
  flex: 1;
  text-align: center;
  height: 40px;
  line-height: 40px;
  font-size: 15px;
}

.tab-cotrol .tab-items span {
  padding: 6px;
}

.actived {
  border-bottom: 3px solid var(--color-high-text);
  color: var(--color-high-text);

}
</style>
